const { ccclass, property } = cc._decorator;

import * as core from "../../core"
import Stone from "../../prefab/Stone";

@ccclass
export default class GameEntities extends cc.Component {
    @property({ type: cc.Prefab })
    stonePrefab: cc.Prefab = null
    @property({ type: cc.Prefab })
    stoneExplosion: cc.Prefab = null

    public initStones() {
        let self = this
        let limitX = 2000
        let limitY = 10000
        for (let i = 0; i < 100; i++) {
            let stone = cc.instantiate(this.stonePrefab)
            this.node.addChild(stone)
            stone.setPosition((Math.random() - 1) * limitX, Math.random() * limitY + 100)
            stone.group = "Scene"
        }
    }

    start() {
        Stone.gameEntities = this
    }
    update(dt: number) { }
    onDestroy() {
        Stone.gameEntities = null
    }
}